#comments-start - More Info Dialog
[SCRIPT NAME]Close Process
Description:
    - Closes one or more processes with the specified process name or PID.

Arguments:
    - Args1: Process Name or PID (Required) - e.g. iexplore.exe, notepad.exe, 4567
    - Args2: Close all instances [Optional]
	    - Options:
	        - True
		    - False (Default)
	    - Some applications will close all related/child processes when shutting down.
#comments-end - More Info Dialog

#include <Include\WinClickPro.au3>

Func Main()
	;
	; This script has 1 required argument and 1 optional.
	;
	If $CmdLine[0] < 1 Then
		_DisplayErrorAndExit("Invalid argument count detected!" & @LF & "Count: " & $CmdLine[0])
	EndIf

	; Does the user want to close all processes or just one?
	If ($CmdLine[0] == 2 And StringLower($CmdLine[2]) == "true") Then
		; Continue until we can't find specified process
		While (ProcessExists($CmdLine[1]))
			ProcessClose($CmdLine[1])
			Sleep(250) ; Give processes a chance to close
		Wend
	Else
		ProcessClose($CmdLine[1])
	EndIf
EndFunc

Main()
Exit @error